﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SuuntoAmbitConnector
{
    public static class EndomondoActivityMapping
    {

        private static Dictionary<int, int> _endomondoActivityMap = null;

        public static int GetEndomondoActivityType(int suuntoAmbitActivityCode)
        {
            if (!EndomondoActivityMap.ContainsKey(suuntoAmbitActivityCode))
                throw new ArgumentException(string.Format("Suunto Ambit activity {0} does not exist", suuntoAmbitActivityCode), "suuntoAmbitActivityCode");

            return EndomondoActivityMap[suuntoAmbitActivityCode];
        }

        /// <summary>
        /// The mapping between Suunto Ambit activities and Endomondo activity types.
        /// 
        /// Map key represents the Suunto Ambit activity code
        ///   Value represents the Endomondo activity type code
        ///   
        /// Example of datastructure usage:
        /// endomondoActivityType = map[suuntoActivityCode]
        /// </summary>
        private static Dictionary<int, int> EndomondoActivityMap
        {
            get
            {
                if (_endomondoActivityMap == null)
                {
                    _endomondoActivityMap = new Dictionary<int, int>();
                    _endomondoActivityMap.Add(4, 2); // cycling
                    _endomondoActivityMap.Add(3, 0); // running
                    _endomondoActivityMap.Add(5, 3); // mountainbike
                    _endomondoActivityMap.Add(25, 35); // soccer
                }

                return _endomondoActivityMap;
            }
        }
    }
}
